using System;
using System.Collections.Generic;
using System.Text;

using System.Web;
using System.Web.SessionState;
using Pampa.CRUD.Configuration;
using Pampa.CRUD.Core;

namespace Pampa.CRUD.Utils
{
    public static class Session
    {
        public static void SaveEntity(string id, object entity)
        {
            HttpContext.Current.Session.Add("entity_" + id, entity);
        }

        public static object GetEntity(string id)
        {
            return HttpContext.Current.Session["entity_" + id];
        }

        public static void RemoveEntity(string id)
        {
            HttpContext.Current.Session.Remove("entity_" + id);
        }

        public static void SaveConfig(string id, EntityConfiguration config)
        {
            HttpContext.Current.Session.Add("config_" + id, config);
        }

        public static EntityConfiguration GetConfig(string id)
        {
            return (EntityConfiguration)HttpContext.Current.Session["config_" + id];
        }
    }
}
